set doc off
set verify off
set serveroutput on size 1000000;

declare   
    l_total_extracted	NUMBER;
	l_total_imported	NUMBER;
	l_func_id			VARCHAR2(100):='CAPGLREC_PERIOD';
    
begin
	SELECT COUNT(1) 
	INTO l_total_extracted
    from   gl_period_statuses 
    where  set_of_books_id = upper('&1');
	
    SELECT COUNT(1) 
	INTO l_total_imported
	from   gl_period_statuses 
    where  set_of_books_id = upper('&1');
	
	dbms_output.put_line('Function: '||l_func_id);		
	dbms_output.put_line('Total Extracted: '||TO_CHAR(l_total_extracted)) ;
	dbms_output.put_line('Total Imported:  '||TO_CHAR(l_total_imported));
	IF l_total_extracted <> l_total_imported THEN
		dbms_output.put_line('Error: No. of Records do not match!');
	END IF;		
						
EXCEPTION
	WHEN OTHERS THEN	
		dbms_output.put_line('Function Error: '||l_func_id);
		
end;
/

